package com.mauth.common.entity.auth;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.mauth.common.entity.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Scope extends BaseEntity {
    private String name;
    private String description;
    @ManyToOne(fetch = FetchType.EAGER)
    @JsonBackReference
    @JoinColumn(
            name = "role_id",
            referencedColumnName = "id",
            nullable = false,
            columnDefinition = "integer")
    private Role role;
}
